# -*- coding: utf-8 -*-
# @Time    : 2024/7/8 0:13
# @Author  : wangwei
# @File    : runner.py
import os
import time

from common.AppKeyword import Appkeyword

# get_pro=os.popen("netstat -ano|findstr 4723").read().split(" ")[-1]
# print(get_pro)
# os.system(f"taskkill /f /pid {get_pro}")


if __name__ == "__main__":

    # os.system("adb connect 127.0.0.1:5555")
    app=Appkeyword()
    app.start_appuim()
    app.start_app(
        '{"platformName": "Android", "deviceName": "127.0.0.1:7555", "appPackage": "com.tencent.mobileqq", "appActivity": ".activity.SplashActivity", "noReset": "true", "ensureWebviewsHavePages": "true"}')
    #
    # app.start_app('{"platformName": "Android", "deviceName": "127.0.0.1:7555", "appPackage": "com.tencent.mobileqq", "appActivity": ".activity.SplashActivity", "noReset": "true", "ensureWebviewsHavePages": "true"}')
    app.sleep("20")
    app.click("同意协议")
    app.click('//*[@text="一键登录"]')
    app.sleep("10")
    app.click("账户及设置")
    app.click("设置")
    app.click('//*[@text="账号管理"]')
    app.click('//*[@text="退出"]')
    app.click('//*[@text="退出登录"]')
    app.click('com.tencent.mobileqq:id/dialogRightBtn')
    app.sleep("2")
    app.assert_page_contains("我老婆是康雪")
    # app.start_app('{"platformName": "Android", "deviceName": "127.0.0.1:7555", "appPackage": "com.baidu.searchbox", "appActivity": ".SplashActivity", "noReset": "true", "ensureWebviewsHavePages": "true","unicodeKeyboard":"true","resetKeyboard":"true"}')
    # app.sleep("10")
    # app.click("//*[@content-desc=\"百度搜索，请输入\"]")
    # app.input("//*[@text=\"请输入搜索关键词\"]","自动化测试")
    # app.keyevent("66")
    # app.sleep("10")






